//
//  AppStaticInLine.h
//  PeiJue
//
//  Created by 李西亚 on 2017/9/20.
//  Copyright © 2017年 lixiya. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDefine.h"

// 主线程执行
UIKIT_STATIC_INLINE void dispatch_main_async(dispatch_block_t block) {
    if ([NSThread isMainThread]) {
        block();
    } else {
        dispatch_async(dispatch_get_main_queue(), block);
    }
}


/**
 * 定义一个静态内联函数
 */
UIKIT_STATIC_INLINE dispatch_queue_t KMainGlobalQueue(){
    
    return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
}

/**
 * 如果字符串为空 则返回默认
 */
UIKIT_STATIC_INLINE NSString *FormatString(NSString *string) {
    if isNULLString(string) {
        return @"---";
    }
    return string;
}

/**
 * 如果字符串为空 则返回默认
 */
UIKIT_STATIC_INLINE NSString *FormatStringWithDef(NSString *string, NSString *defString) {
    if isNULLString(string) {
        return defString;
    }
    return string;
}

